home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / dosmon.arc / DOSMON.LOG < prev    next >
Encoding:
Text File  |  1986-05-17  |  11.2 KB  |  399 lines

  1. -f100 500 0
  2. -a100
  3. 1149:0100 ;
  4. 1149:0100 ;----------------------------------------
  5. 1149:0100 ; DOSMON - DOS Activity Monitor
  6. 1149:0100 ;----------------------------------------
  7. 1149:0100 ;
  8. 1149:0100 ; This program will terminate and stay resident.  It intercepts the
  9. 1149:0100 ; DOS service interrupt and displays status information on the
  10. 1149:0100 ; screen during DOS service execution periods.
  11. 1149:0100 ;
  12. 1149:0100 ; S.H.Smith, 15-may-86
  13. 1149:0100 ;
  14. 1149:0100 
  15. -
  16. -a100
  17. 1149:0100 ;----------------------------------------
  18. 1149:0100 ; startup entry point
  19. 1149:0100 ;----------------------------------------
  20. 1149:0100    jmp 2e0       ;install
  21. 1149:0103 
  22. -
  23. -a103
  24. 1149:0103 ; vector for old interrupt
  25. 1149:0103    db 0,0,0,0
  26. 1149:0107 
  27. -
  28. -a107
  29. 1149:0107 ; segment address for display memory
  30. 1149:0107 ; filled in by startup code
  31. 1149:0107    dw 0
  32. 1149:0109 
  33. -
  34. -a10e
  35. 1149:010E ; twiddle display index
  36. 1149:010E    dw 0
  37. 1149:0110 
  38. -
  39. -a110
  40. 1149:0110 ; twiddle display characters
  41. 1149:0110    db "─\│/"
  42. 1149:0114 
  43. -
  44. -a118
  45. 1149:0118 ; 118..11B used for vector back to user
  46. 1149:0118 ; 11c used for first save char
  47. 1149:0118 ; 11e used for second save char
  48. 1149:0118 ; 120 used for third save char
  49. 1149:0118 ; 122 scratch ax save
  50. 1149:0118 ; 124 ss save
  51. 1149:0118 ; 126 sp save
  52. 1149:0118 
  53. -
  54. -a130
  55. 1149:0130 ; a signature in bytes
  56. 1149:0130    db 0a,0d,'DOSMON - DOS Activity Monitor',0a,0d
  57. 1149:0151    db '$  S.H.Smith, 15-May-86',0a,0d
  58. 1149:016A    db 1a
  59. 1149:016B 
  60. -
  61. -a170
  62. 1149:0170 ;----------------------------------------
  63. 1149:0170 ; new DOS service interrupt
  64. 1149:0170 ;----------------------------------------
  65. 1149:0170 ;
  66. 1149:0170    cs:
  67. 1149:0171    pop [118]       ;get return ip
  68. 1149:0175    cs:
  69. 1149:0176    pop [11a]       ;get return cs
  70. 1149:017A    popf            ;get flags
  71. 1149:017B ;
  72. 1149:017B    pushf
  73. 1149:017C    push ds
  74. 1149:017D    push es
  75. 1149:017E    push bx         ;save entry registers
  76. 1149:017F    push ax
  77. 1149:0180 ;
  78. 1149:0180 ;----------------------------------------
  79. 1149:0180 ; save the previous display data
  80. 1149:0180 ;
  81. 1149:0180    cs:
  82. 1149:0181    mov ax,[107]    ;get display segment into es
  83. 1149:0184    mov es,ax
  84. 1149:0186 ;
  85. 1149:0186    es:
  86. 1149:0187    mov ax,[94]     ;save original screen contents
  87. 1149:018A    cs:
  88. 1149:018B    mov [11c],ax
  89. 1149:018E ;
  90. 1149:018E    es:
  91. 1149:018F    mov ax,[96]     ;second char
  92. 1149:0192    cs:
  93. 1149:0193    mov [11e],ax
  94. 1149:0196 ;
  95. 1149:0196    es:
  96. 1149:0197    mov ax,[98]     ;third char
  97. 1149:019A    cs:
  98. 1149:019B    mov [120],ax
  99. 1149:019E ;
  100. 1149:019E ;----------------------------------------
  101. 1149:019E ; prepare display with blanks
  102. 1149:019E ;
  103. 1149:019E    mov ax,0f20     ;space with attribute of 15
  104. 1149:01A1    es:
  105. 1149:01A2    mov [94],ax
  106. 1149:01A5    es:
  107. 1149:01A6    mov [96],ax     ;set attribute of the function code locations
  108. 1149:01A9    es:             ;and leave them blank in case of 'exec' function
  109. 1149:01AA    mov [98],ax
  110. 1149:01AD ;
  111. 1149:01AD    pop ax          ;get DOS function code into ah
  112. 1149:01AE    push ax
  113. 1149:01AF ;
  114. 1149:01AF    cmp ah,4b       ;is this an exec call?
  115. 1149:01B2    jz 228          ;leave display blank if so
  116. 1149:01B4 ;
  117. 1149:01B4 ;----------------------------------------
  118. 1149:01B4 ; display the rotating twiddle character
  119. 1149:01B4 ;
  120. 1149:01B4    cs:
  121. 1149:01B5    mov bx,[10e]    ;get twiddle index
  122. 1149:01B9    inc bx
  123. 1149:01BA    mov al,bl       ;advance to next twiddle position
  124. 1149:01BC    and al,3        ;bx=bx mod 4 to rotate through twiddles
  125. 1149:01BE    mov bl,al
  126. 1149:01C0    cs:
  127. 1149:01C1    mov [10e],bx    ;save next twiddle index
  128. 1149:01C5 ;
  129. 1149:01C5    cs:
  130. 1149:01C6    mov ah,[110+bx] ;get the next twiddle character
  131. 1149:01CA    es:
  132. 1149:01CB    mov [94],ah     ;put twiddle status on screen
  133. 1149:01CF ;
  134. 1149:01CF ;----------------------------------------
  135. 1149:01CF ; display the DOS service number in hex
  136. 1149:01CF ;
  137. 1149:01CF    pop ax          ;get the dos function code into ah
  138. 1149:01D0    push ax
  139. 1149:01D1 ;
  140. 1149:01D1    and ah,0f
  141. 1149:01D4    add ah,30       ;convert low digit to hex
  142. 1149:01D7 ;
  143. 1149:01D7    cmp ah,3a       ;handle A..F
  144. 1149:01DA    jb 1e8
  145. 1149:01DC    add ah,7
  146. 1149:01DF    jmp 1e8
  147. 1149:01E1 
  148. -
  149. -a1e8
  150. 1149:01E8    es:
  151. 1149:01E9    mov [98],ah     ;and set LSB on screen
  152. 1149:01ED ;
  153. 1149:01ED    pop ax          ;get fresh copy of function code into ah
  154. 1149:01EE    push ax
  155. 1149:01EF ;
  156. 1149:01EF    shr ah,1        ;move down bits for high digit
  157. 1149:01F1    shr ah,1
  158. 1149:01F3    shr ah,1
  159. 1149:01F5    shr ah,1        ;make high byte hex and put on screen
  160. 1149:01F7    and ah,0f
  161. 1149:01FA    add ah,30
  162. 1149:01FD ;
  163. 1149:01FD    cmp ah,3a       ;handle A..F
  164. 1149:0200    jb 218
  165. 1149:0202    add ah,7
  166. 1149:0205    jmp 218
  167. 1149:0207 
  168. -
  169. -a218
  170. 1149:0218    es:
  171. 1149:0219    mov [96],ah     ;set MSB on screen
  172. 1149:021D    jmp 228
  173. 1149:021F 
  174. -
  175. -a228
  176. 1149:0228 ;----------------------------------------
  177. 1149:0228 ; perform the DOS service function
  178. 1149:0228 ;
  179. 1149:0228    pop ax
  180. 1149:0229    pop bx
  181. 1149:022A    pop es          ;restore initial entry registers
  182. 1149:022B    pop ds
  183. 1149:022C    popf
  184. 1149:022D ;
  185. 1149:022D    cs:
  186. 1149:022E    push [118]
  187. 1149:0232    cs:             ;push static variables to make this program
  188. 1149:0233    push [11a]      ;recursive - DOS uses many recursive functions
  189. 1149:0237    cs:
  190. 1149:0238    push [11c]
  191. 1149:023C    cs:
  192. 1149:023D    push [11e]
  193. 1149:0241    cs:
  194. 1149:0242    push [120]
  195. 1149:0246    cs:
  196. 1149:0247    push [124]
  197. 1149:024B    cs:
  198. 1149:024C    push [126]
  199. 1149:0250 ;
  200. 1149:0250    cs:
  201. 1149:0251    mov [122],ax
  202. 1149:0254    mov ax,ss
  203. 1149:0256    cs:
  204. 1149:0257    mov [124],ax    ;preserve ss:sp in case dos loses it!
  205. 1149:025A    mov ax,sp
  206. 1149:025C    cs:
  207. 1149:025D    mov [126],ax
  208. 1149:0260    cs:
  209. 1149:0261    mov ax,[122]
  210. 1149:0264 ;
  211. 1149:0264    pushf           ;push flags to simulate action of 'int 21'
  212. 1149:0265    cs:
  213. 1149:0266    call far [103]  ;call the real DOS service interrupt
  214. 1149:026A ;
  215. 1149:026A    cs:
  216. 1149:026B    mov [122],ax
  217. 1149:026E    cs:
  218. 1149:026F    mov ax,[124]    ;restore ss:sp
  219. 1149:0272    mov ss,ax
  220. 1149:0274    cs:
  221. 1149:0275    mov ax,[126]
  222. 1149:0278    mov sp,ax
  223. 1149:027A    cs:
  224. 1149:027B    mov ax,[122]
  225. 1149:027E ;
  226. 1149:027E    cs:
  227. 1149:027F    pop [126]
  228. 1149:0283    cs:
  229. 1149:0284    pop [124]
  230. 1149:0288    cs:
  231. 1149:0289    pop [120]
  232. 1149:028D    cs:
  233. 1149:028E    pop [11e]       ;restore static variables after return from recursion
  234. 1149:0292    cs:
  235. 1149:0293    pop [11c]
  236. 1149:0297    cs:
  237. 1149:0298    pop [11a]
  238. 1149:029C    cs:
  239. 1149:029D    pop [118]
  240. 1149:02A1 ;
  241. 1149:02A1    pushf
  242. 1149:02A2    push ax         ;save DOS exit registers for later use
  243. 1149:02A3    push es
  244. 1149:02A4    push ds
  245. 1149:02A5 ;
  246. 1149:02A5 ;----------------------------------------
  247. 1149:02A5 ; restore original screen contents
  248. 1149:02A5 ;
  249. 1149:02A5    cs:
  250. 1149:02A6    mov ax,[107]    ;get display page into es
  251. 1149:02A9    mov es,ax
  252. 1149:02AB ;
  253. 1149:02AB    cs:
  254. 1149:02AC    mov ax,[11c]
  255. 1149:02AF    es:            ;put old data on screen
  256. 1149:02B0    mov [94],ax    ;first char
  257. 1149:02B3 ;
  258. 1149:02B3    cs:
  259. 1149:02B4    mov ax,[11e]
  260. 1149:02B7    es:
  261. 1149:02B8    mov [96],ax    ;second char
  262. 1149:02BB ;
  263. 1149:02BB    cs:
  264. 1149:02BC    mov ax,[120]
  265. 1149:02BF    es:
  266. 1149:02C0    mov [98],ax    ;third char
  267. 1149:02C3 ;
  268. 1149:02C3 ;----------------------------------------
  269. 1149:02C3 ; end of interrupt - return to the caller
  270. 1149:02C3 ;
  271. 1149:02C3    pop ds
  272. 1149:02C4    pop es
  273. 1149:02C5    pop ax
  274. 1149:02C6    popf             ;get return flags
  275. 1149:02C7    cs:
  276. 1149:02C8    jmp far [118]    ;jump back to user code
  277. 1149:02CC 
  278. -
  279. -a2e0
  280. 1149:02E0 ;----------------------------------------
  281. 1149:02E0 ; startup code
  282. 1149:02E0 ;----------------------------------------
  283. 1149:02E0 ; determine where the video ram is.  this is done by putting a special
  284. 1149:02E0 ; character on the screen and then looking for it in the various video
  285. 1149:02E0 ; ram locations.
  286. 1149:02E0 ;
  287. 1149:02E0    push cs
  288. 1149:02E1    pop ds
  289. 1149:02E2 ;
  290. 1149:02E2    mov ah,3         ;get cursor position
  291. 1149:02E4    int 10           ;video bios service
  292. 1149:02E6    push ax
  293. 1149:02E7    push bx
  294. 1149:02E8    push dx          ;save it for later
  295. 1149:02E9 ;
  296. 1149:02E9    mov dx,0
  297. 1149:02EC    mov ah,2         ;home the cursor
  298. 1149:02EE    int 10
  299. 1149:02F0 ;
  300. 1149:02F0    mov ah,0A
  301. 1149:02F2    mov al,88        ;display a funny char at cursor
  302. 1149:02F4    mov cx,1
  303. 1149:02F7    int 10
  304. 1149:02F9 ;
  305. 1149:02F9 ; move cursor back to original position
  306. 1149:02F9 ;
  307. 1149:02F9    pop dx
  308. 1149:02FA    pop bx
  309. 1149:02FB    pop ax
  310. 1149:02FC    mov ah,2
  311. 1149:02FE    int 10
  312. 1149:0300 ;
  313. 1149:0300 ; look for MONO video ram
  314. 1149:0300 ;
  315. 1149:0300    mov dl,88
  316. 1149:0302    mov ax,b000
  317. 1149:0305    mov es,ax
  318. 1149:0307    es:
  319. 1149:0308    cmp dl,[0]
  320. 1149:030C    jz 360
  321. 1149:030E ;
  322. 1149:030E ; look for COLOR video ram
  323. 1149:030E ;
  324. 1149:030E    mov ax,b800
  325. 1149:0311    mov es,ax
  326. 1149:0313    es:
  327. 1149:0314    cmp dl,[0]
  328. 1149:0318    jz 360
  329. 1149:031A ;
  330. 1149:031A ; couldn't find video ram; display a message and abort
  331. 1149:031A ;
  332. 1149:031A    mov dx,308
  333. 1149:031D    mov ah,9
  334. 1149:031F    int 21           ;display error message
  335. 1149:0321    int 20           ;terminate program
  336. 1149:0323 
  337. -
  338. -a328
  339. 1149:0328    db "ERROR: Can't find display memory$"
  340. 1149:0349 
  341. -
  342. -a360
  343. 1149:0360 ;
  344. 1149:0360    cs:
  345. 1149:0361    mov [107],ax     ;set the display segment
  346. 1149:0364 ;
  347. 1149:0364 ;----------------------------------------
  348. 1149:0364 ; display the program signon message now that we are sure
  349. 1149:0364 ; that we can be installed
  350. 1149:0364 ;
  351. 1149:0364    mov dx,130
  352. 1149:0367    mov ah,9
  353. 1149:0369    int 21           ;display signon message
  354. 1149:036B ;
  355. 1149:036B ;----------------------------------------
  356. 1149:036B ; now install new interrupt handler
  357. 1149:036B ;
  358. 1149:036B    mov ax,0
  359. 1149:036E    mov es,ax
  360. 1149:0370 ;
  361. 1149:0370 ; save old DOS service vector
  362. 1149:0370 ;
  363. 1149:0370    es:
  364. 1149:0371    mov ax,[84]
  365. 1149:0374    cs:
  366. 1149:0375    mov [103],ax
  367. 1149:0378 ;
  368. 1149:0378    es:
  369. 1149:0379    mov ax,[86]
  370. 1149:037C    cs:
  371. 1149:037D    mov [105],ax
  372. 1149:0380 ;
  373. 1149:0380 ; install new vector
  374. 1149:0380 ;
  375. 1149:0380    mov ax,170       ;entry point offset
  376. 1149:0383    es:
  377. 1149:0384    mov [84],ax
  378. 1149:0387 ;
  379. 1149:0387    mov ax,cs        ;this code segment
  380. 1149:0389    es:
  381. 1149:038A    mov [86],ax
  382. 1149:038D ;
  383. 1149:038D ; set last resident code offset
  384. 1149:038D ; and terminate-and-stay-resident
  385. 1149:038D ;
  386. 1149:038D    mov al,0         ;exit code
  387. 1149:038F    mov dx,30        ;paragraphs to keep resident
  388. 1149:0392    mov ah,31        ;keep process function
  389. 1149:0394    int 21           ;terminate and stay in memory
  390. 1149:0396 
  391. -
  392. -rcx
  393. CX 0000
  394. :400
  395. -ndosmon.com
  396. -w
  397. Writing 0400 bytes
  398. -q
  399.